home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / dbms_mag / 9104 / techtip1.apr < prev    next >
Text File  |  1991-03-26  |  1KB  |  69 lines

  1. Listing 1
  2.  
  3. * Listing 1A
  4.  
  5. * For dBASE IV, FoxPro, Clipper
  6. *
  7. * In Clipper, replace the ON KEY LABEL command with
  8. * SET KEY <expn> TO [procedure]
  9.  
  10. PUBLIC exit_read
  11. STORE .f. TO exit_read
  12. ON KEY LABEL F2 DO ExitLoop
  13. .
  14. .
  15. .
  16. *  Data entry @ SAY/GETS here
  17. .
  18. .
  19. .
  20. DO WHILE .NOT. exit_read
  21.    READ SAVE
  22. ENDDO
  23.  
  24. * Put the rest of your data entry code here
  25.  
  26. PROCEDURE ExitLoop
  27. STORE .t. TO exit_read
  28. KEYBOARD <appropriate key code for Page Down>
  29.  
  30. * Listing 1B
  31.  
  32. * For Sophco╒s Force
  33.  
  34. VARDEF
  35.    LOGICAL exit_read = .f.
  36. ENDDEF
  37.  
  38. PROCEDURE data_entry
  39. ON KEY DO check_key_stroke   && acts as a keystroke filter
  40. .
  41. .
  42. .
  43. *  Data entry @ SAY/GETS here
  44. .
  45. .
  46. .
  47. DO WHILE .NOT. exit_read
  48.    READ SAVE
  49. ENDDO
  50.  
  51. * Put the rest of your data entry code here
  52.  
  53. ENDPRO
  54.  
  55. FUNCTION check_key_stroke
  56. VARDEF
  57.    UINT   TheKey
  58. ENDDEF
  59. TheKey = Lastkey()
  60. DO CASE
  61.    CASE TheKey = &K_F2
  62.       exit_read = .t.
  63.       RETURN 0         && Ignore this keystroke
  64.    <Other filter conditions here>
  65.    OTHERWISE
  66.       RETURN TheKey    && Pass the keystroke thru
  67. ENDCASE
  68. ENDPRO
  69.